﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class student : IComparable
    {
        public string stuno { get; set; }
        public string stuname { get; set; }

        public string age { get; set; }
        public student(string stuno ,string stuname,string age) {

            this.stuno = stuno;
            this.stuname = stuname;
            this.age = age;
        }
        public override string ToString()
        {
            return $"学号：{stuno}，姓名{stuname },年龄{age }";
        }



        public int CompareTo(object obj)
        {
            if (obj is student)
            {
                return this.CompareTo(((student )obj ).age);
            }
            else
            {
                throw new Exception("搞错了，不是这个学生哦！");
            }
        }
    }
}
